#include "widget.h"
#include "ui_widget.h"
#include <QThreadPool>
#include <QLabel>
#include <QTimer>
Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
    task1 = new Task1;
    THREADPOOL=QThreadPool::globalInstance();
    THREADPOOL->setMaxThreadCount(4);
    connect(task1,&Task1::task_signal,[this](int val){
        ui->lcdNumber->display(QString::number(val));
    });
}

Widget::~Widget()
{
    delete ui;
}

void Widget::on_pushButton_clicked()
{
    THREADPOOL->start(task1);
}
